package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.mapper.DeviceStatusTunnelProtectMapper;
import com.ruoyi.net.domain.DeviceStatusTunnelProtect;
import com.ruoyi.net.service.IDeviceStatusTunnelProtectService;

/**
 * 设备状态-隧道内保护详细状态Service业务层处理
 * 
 * @author tony
 * @date 2024-12-18
 */
@Service
public class DeviceStatusTunnelProtectServiceImpl implements IDeviceStatusTunnelProtectService 
{
    @Autowired
    private DeviceStatusTunnelProtectMapper deviceStatusTunnelProtectMapper;

    /**
     * 查询设备状态-隧道内保护详细状态
     * 
     * @param id 设备状态-隧道内保护详细状态主键
     * @return 设备状态-隧道内保护详细状态
     */
    @Override
    public DeviceStatusTunnelProtect selectDeviceStatusTunnelProtectById(String id)
    {
        return deviceStatusTunnelProtectMapper.selectDeviceStatusTunnelProtectById(id);
    }

    /**
     * 查询设备状态-隧道内保护详细状态列表
     * 
     * @param deviceStatusTunnelProtect 设备状态-隧道内保护详细状态
     * @return 设备状态-隧道内保护详细状态
     */
    @Override
    public List<DeviceStatusTunnelProtect> selectDeviceStatusTunnelProtectList(DeviceStatusTunnelProtect deviceStatusTunnelProtect)
    {
        return deviceStatusTunnelProtectMapper.selectDeviceStatusTunnelProtectList(deviceStatusTunnelProtect);
    }

    /**
     * 新增设备状态-隧道内保护详细状态
     * 
     * @param deviceStatusTunnelProtect 设备状态-隧道内保护详细状态
     * @return 结果
     */
    @Override
    public int insertDeviceStatusTunnelProtect(DeviceStatusTunnelProtect deviceStatusTunnelProtect)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(deviceStatusTunnelProtect.getId())) {
            deviceStatusTunnelProtect.setId(uuid);
        }
        deviceStatusTunnelProtect.setCreateBy(SecurityUtils.getUsername());
        deviceStatusTunnelProtect.setCreateTime(DateUtils.getNowDate());
        deviceStatusTunnelProtect.setUpdateBy(SecurityUtils.getUsername());
        deviceStatusTunnelProtect.setUpdateTime(DateUtils.getNowDate());
        return deviceStatusTunnelProtectMapper.insertDeviceStatusTunnelProtect(deviceStatusTunnelProtect);
    }

    /**
     * 修改设备状态-隧道内保护详细状态
     * 
     * @param deviceStatusTunnelProtect 设备状态-隧道内保护详细状态
     * @return 结果
     */
    @Override
    public int updateDeviceStatusTunnelProtect(DeviceStatusTunnelProtect deviceStatusTunnelProtect)
    {
        deviceStatusTunnelProtect.setUpdateBy(SecurityUtils.getUsername());
        deviceStatusTunnelProtect.setUpdateTime(DateUtils.getNowDate());
        return deviceStatusTunnelProtectMapper.updateDeviceStatusTunnelProtect(deviceStatusTunnelProtect);
    }

    /**
     * 批量删除设备状态-隧道内保护详细状态
     * 
     * @param ids 需要删除的设备状态-隧道内保护详细状态主键
     * @return 结果
     */
    @Override
    public int deleteDeviceStatusTunnelProtectByIds(String[] ids)
    {
        return deviceStatusTunnelProtectMapper.deleteDeviceStatusTunnelProtectByIds(ids);
    }

    /**
     * 删除设备状态-隧道内保护详细状态信息
     * 
     * @param id 设备状态-隧道内保护详细状态主键
     * @return 结果
     */
    @Override
    public int deleteDeviceStatusTunnelProtectById(String id)
    {
        return deviceStatusTunnelProtectMapper.deleteDeviceStatusTunnelProtectById(id);
    }
}
